package com.leyou.personnel.controller;

import com.leyou.common.pojo.Result;
import com.leyou.common.pojo.ResultLogin;
import com.leyou.personnel.data.vo.ManagerLoginVo;
import com.leyou.personnel.service.AdministratorsManagerService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * @author xhh
 * @describe 描述
 * @date 2022/5/18
 */
@Api(tags = "登录接口")
@RequestMapping("/login")
@RestController
public class LoginController {
    @Autowired
    private AdministratorsManagerService administratorsManagerService;
    @Autowired
    private RedisTemplate redisTemplate;
    @Autowired
    private HttpServletRequest request;
    /**
     * @author: xhh
     * @date: 2022/5/18
     * @description: 管理员登录
     * @return:
     * @params:
     */
    @RequestMapping(value = "/managerLogin",method = RequestMethod.POST)
    public ResultLogin managerLogin(@RequestBody ManagerLoginVo managerLoginVo){
        Result<Map<String,Object>> result=new Result<>();
        return administratorsManagerService.managerLogin(managerLoginVo);
    }

    @RequestMapping(value = "/testHttpRequest")
    public Object testHttpSession(){
        Object managerAccountNumber = request.getAttribute("managerAccountNumber");

        return managerAccountNumber;
    }


}
